<template lang="html">
  <section class="wrapper">
    <!-- progress -->
    <div class="progress-bg">
      <div class="progress-entity"></div>
    </div>
    <!-- ball -->
    <div class="ball"></div>
    <!-- card-box -->
    <div class="card-box" :class="{'active': clicked}">
      <a class="card-btn material-icons" @click="click">add</a>
      <div class="card">
        <div class="card-heading">
          头部
        </div>
        <div class="card-body">
          内容
        </div>
      </div>
    </div>
    <!-- ripple-btn -->
    <a class="ripple-btn">
      <touch-ripple
        class="ripple-item"
        :center-ripple="false"
      >
      点击
      </touch-ripple>
    </a>
    <!-- ripple -->
    <ripple class="ripple">测试</ripple>
    <!-- ripple-btn -->
    <ripple-btn class="ripple" color="yellow">点击</ripple-btn>
  </section>
</template>

<script>
import touchRipple from '@/components/ripple/touchRipple';
import ripple from '@/components/ripple/ripple';
import rippleBtn from '@/components/ripple/rippleBtn';
export default {
  data() {
    return {
      clicked: false,
    }
  },
  methods: {
    click() {
      this.clicked = !this.clicked;
    }
  },
  components: {
    touchRipple,
    ripple,
    rippleBtn
  }
}
</script>

<style lang="scss" scoped>
@import "../../assets/scss/default.scss";
.wrapper {
  width: px2rem(750);
  height: 100%;
  background-color: $green;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: scroll;
}
// progress
.progress-bg {
  width: 100%;
  height: px2rem(2);
  background-color: transparent;
  // background-color: rgba($red, 0.6);
  position: fixed;
  top: 0;
  left: 0;
  .progress-entity {
    width: 0%;
    height: 100%;
    background-color: rgba($red, 1);
    transform-origin: 0 0;
    animation: loading 3s ease;
  }
}
@keyframes loading {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}
// ball
.ball {
  margin: px2rem(50) auto;
  width: px2rem(100);
  height: px2rem(100);
  background: $red;
  box-shadow: $red 1px 0 6px 1px;
  border-radius: 100%;
  opacity: 1;
  animation: shine 3s ease infinite;
}
@keyframes shine {
  30% {
    opacity: 0.5;
  }
  60% {
    opacity: 1;
  }
  90% {
    opacity: 0.5;
  }
}
// card
.card-box {
  margin-top: px2rem(100);
  font-size: px2rem(28);
  color: $default;
  width: 100%;
  position: relative;
  .card-btn {
    color: $white;
    background-color: $red;
    width: px2rem(100);
    height: px2rem(100);
    border-radius: 50%;
    font-size: px2rem(50);
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 50%;
    top: 0%;
    margin-left: px2rem(-50);
    margin-top: px2rem(-50);
    z-index: 2;
    transition: transform .2s linear;
    box-shadow: $red 1px 0 6px 1px;
  }
  .card {
    position: relative;
    margin: 0 auto;
    z-index: 1;
    width: px2rem(600);
    height: px2rem(300);
    padding: px2rem(60) px2rem(30) px2rem(30);
    box-sizing: border-box;
    background-color: $white;
    transform: scale(0) translateZ(0);
    transition: .2s all cubic-bezier(.4,0,.2,1);
    transform-origin: top center;
    opacity: 0;
    .card-heading {
      text-align: center;
    }
    .card-body {
      text-align: left;
    }
  }
  &.active {
    .card-btn {
      transform: rotate(45deg);
    }
    .card {
      transform: scale(1) translateZ(0);
      opacity: 1;
    }
  }
}
// ripple-btn
.ripple-btn {
  width: px2rem(200);
  height: px2rem(100);
  text-align: center;
  line-height: px2rem(100);
  position: relative;
  display: block;
  color: $white;
  background-color: $red;
  margin: auto;
}
// ripple
.ripple {
  width: px2rem(200);
  height: px2rem(100);
  text-align: center;
  line-height: px2rem(100);
  position: relative;
  display: block;
  margin: px2rem(30) auto;
  // background-color: $red;
  color: $white;
  border: 1px solid $white;
}
</style>
